<extend name="Public:list_layout" />
<block name="title"><title>添加专题</title></block>
<block name="subnav"></block>
<block name="main">
  <form name="myform" action="__CONTROLLER__/listorder" method="post">
    <div class="table-list">
      <table width="100%" cellspacing="0">
        <thead>
          <tr>
            <th width="16"><input type="checkbox" value="" id="check_box" onclick="selectall('ids[]');"></th>
            <th width="150">小说名</th>
            <th align="center" width="50">分类</th>
            <th align="center" width="50">作者</th>
            <th align="center">描述</th>
            <th>所属专题</th>
          </tr>
        </thead>
        <tbody>
          <?php  foreach ($novels as $key => $value) { ?>
          <tr>
            <td align="center"><input class="inputcheckbox " name="ids[]" value="<?php echo $value['id']; ?>" type="checkbox"></td>
            <td align="center"><?php echo $value['name']; ?></td>
            <td><?php echo $value['category']; ?></td>
            <td><?php echo $value['author']; ?></td>
            <td><?php echo $value['des']; ?></td>
            <td align="center">
              <input name="subject" type="text" data-val="<?php echo $value['id']; ?>" value="<?php echo $value['subjects'];?>"/>
            </td>
          </tr>
          <?php } ?>
        </tbody>
      </table>

    </div>
    <div class="btn">
        <label for="check_box">全选/取消</label>
        <input name="deletesubmit" type="submit" class="button" value="删除" onclick="document.myform.action='<?php echo U('Novel/delete'); ?>';return confirm('确认要删除 『 选中 』 吗？')">
    </div>
  </form>
  <script type="text/javascript">
    $(function(){
      $("input[name='subject']").blur(function(){
        var nid = $(this).attr('data-val');
        var subject = $(this).val();
        $.post("<?php echo U('/Admin/Subject/add');?>", {'subject': subject, 'nid': nid}, function(d){
          //window.location.reload();
        });
      });
    });
  </script>
</block>